extends Node2D
const PIPE_BOTTOM = preload("res://scenes/pipe_bottom.tscn")
@onready var pip_bottom_pos = $pip_bottom_pos
#var screen_height = get_viewport_rect().size.height # 获取屏幕高度

func _ready():
	spawn_pipe_bottom()

func spawn_pipe_bottom():
	var pipe_bottom = PIPE_BOTTOM.instantiate()
	pipe_bottom.global_position.x = pip_bottom_pos.position.x
	pipe_bottom.global_position.y = -pip_bottom_pos.global_position.y
	pipe_bottom.set_size(pip_bottom_pos.global_position.y)
	add_child(pipe_bottom)

func _on_area_2d_body_entered(body):
	if body.is_in_group("player"):
		body.go_into_pip()
	pass # Replace with function body.
